package com.erlinyou.im.dao.repository.groupmove;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.Query;

import com.erlinyou.base.dao.BaseRepository;
import com.erlinyou.im.model.groupmove.Ofhistorymessage;

public interface OfhistoryRepository extends BaseRepository<Ofhistorymessage, Long>{

	@Query(value="SELECT hmfrom,hmto,hmmsgid,hmcreatetime,hmgid,cast(aes_decrypt(hmcontentblob,'erlinyou1234JCLT+.') AS CHAR charset utf8) AS hmcontentblob,hmclientmsgid,hmtype,properties FROM ofhistorymessage WHERE hmcreatetime > 0 AND hmtype = 'chat' LIMIT ?1,?2",nativeQuery=true)
	List<Map<String, Object>> selectAll(int startPage, int rows);

	@Query(value="SELECT hmcreatetime, cast(aes_decrypt(hmcontentblob, 'erlinyou1234JCLT+.' ) AS CHAR charset utf8 ) AS hmcontentblob FROM ofhistorymessage WHERE hmfrom = '%-1*!;15109;1526302343023874@conference.chatcn.jingcailvtu.com/26@chatcn.jingcailvtu.com' AND hmgid = '%-1*!;15109;1526302343023874@conference.chatcn.jingcailvtu.com' ORDER BY hmcreatetime DESC",nativeQuery=true)
	List<Map<String, Object>> selectAllByEric();

	
}
